// 定义图表数据存储
const processingTimeData = {
    labels: [],
    datasets: [{
        label: '平均处理时间 (s)',
        data: [],
        borderColor: 'rgb(75, 192, 192)',
        tension: 0.1
    }]
};

const queueSizeData = {
    labels: [],
    datasets: [{
        label: '请求队列大小',
        data: [],
        borderColor: 'rgb(255, 99, 132)',
        tension: 0.1
    }]
};

const endToEndTimeData = {
    labels: [],
    datasets: [{
        label: '队列大小',
        data: [],
        borderColor: 'rgb(54, 162, 235)', // Blue color
        tension: 0.1
    }]
};

// 获取 canvas 元素
const queueSizeCtx = document.getElementById('queueSizeChart').getContext('2d');
const endToEndTimeCtx = document.getElementById('endToEndTimeChart').getContext('2d');

// 初始化图表
const queueSizeChart = new Chart(queueSizeCtx, {
    type: 'line',
    data: queueSizeData,
    options: {
        scales: {
            y: {
                beginAtZero: true
            }
        }
    }
});

const endToEndTimeChart = new Chart(endToEndTimeCtx, {
    type: 'line',
    data: endToEndTimeData,
    options: {
        scales: {
            y: {
                beginAtZero: true
            }
        }
    }
});

// 根据页面自动识别接口前缀：网络件页面使用 /net 前缀，其余为空
const isNetPage = !!document.getElementById('queryYsbh');
const API_PREFIX = isNetPage ? '/net' : '';

// 异步获取性能数据并更新图表
async function fetchPerformanceData() {
    try {
        const response = await fetch(`${API_PREFIX}/api/performance`); // 同域下的接口
        const data = await response.json();

        const now = new Date().toLocaleTimeString();

        // 更新队列大小图表
        queueSizeData.labels.push(now);
        queueSizeData.datasets[0].data.push(data.current_queue_size);
        if (queueSizeData.labels.length > 20) {
            queueSizeData.labels.shift();
            queueSizeData.datasets[0].data.shift();
        }
        queueSizeChart.update();

        // 由于新的API不再提供average_end_to_end_time，我们使用队列大小作为替代指标
        // 或者可以设置为0，或者移除这个图表
        endToEndTimeData.labels.push(now);
        endToEndTimeData.datasets[0].data.push(data.current_queue_size); // 临时使用队列大小
        if (endToEndTimeData.labels.length > 20) {
            endToEndTimeData.labels.shift();
            endToEndTimeData.datasets[0].data.shift();
        }
        endToEndTimeChart.update();

        // 更新实时指标
        document.getElementById('processedCount').textContent = data.processed_count;
        document.getElementById('successfulCount').textContent = data.successful_count;
        document.getElementById('failedCount').textContent = data.failed_count;

    } catch (error) {
        console.error('获取性能数据失败:', error);
    }
}

// 每 5 秒更新一次数据
setInterval(fetchPerformanceData, 5000);

// 页面加载时立即获取一次数据
fetchPerformanceData();

// --- 调用列表功能 --- START

// 模拟调用数据
let allCalls = [
    {
        bh: "XF001",
        startTime: "2023-10-26 10:00:00",
        status: "成功",
        processTime: 120,
        requestInfo: { method: "POST", url: "/api/submit", payload: { id: 1, type: "complaint" } },
        responseInfo: { status: 200, message: "Success" },
        errorInfo: null
    },
    {
        bh: "XF002",
        startTime: "2023-10-26 10:05:00",
        status: "失败",
        processTime: 250,
        requestInfo: { method: "GET", url: "/api/query", params: { queryId: 123 } },
        responseInfo: null,
        errorInfo: { code: 500, message: "Internal Server Error", details: "Database connection failed" }
    },
    {
        bh: "XF003",
        startTime: "2023-10-25 11:15:00",
        status: "成功",
        processTime: 80,
        requestInfo: { method: "PUT", url: "/api/update", payload: { id: 2, status: "resolved" } },
        responseInfo: { status: 200, message: "Updated" },
        errorInfo: null
    },
    {
        bh: "XF004",
        startTime: "2023-10-26 10:30:00",
        status: "成功",
        processTime: 90,
        requestInfo: { method: "GET", url: "/api/report", params: { date: "2023-10-26" } },
        responseInfo: { status: 200, data: "report_data" },
        errorInfo: null
    },
    {
        bh: "XF005",
        startTime: "2023-10-24 09:00:00",
        status: "失败",
        processTime: 300,
        requestInfo: { method: "POST", url: "/api/auth", payload: { user: "test" } },
        responseInfo: null,
        errorInfo: { code: 401, message: "Unauthorized", details: "Invalid credentials" }
    }
];

let currentCalls = [...allCalls]; // 用于存储当前显示的调用数据

// 获取DOM元素
const queryDateInput = document.getElementById('queryDate');
const queryBhInput = document.getElementById('queryBh');
const queryStatusSelect = document.getElementById('queryStatus');
const searchButton = document.getElementById('searchBtn');
const resetButton = document.getElementById('resetBtn');
const callListTableBody = document.getElementById('callListTableBody');
const detailModal = document.getElementById('detailModal');
const closeButton = detailModal.querySelector('.close-button');

const detailBh = document.getElementById('detailBh');
const detailStartTime = document.getElementById('detailStartTime');
const detailStatus = document.getElementById('detailStatus');
const detailProcessTime = document.getElementById('detailProcessTime');
const detailRequest = document.getElementById('detailRequest');
const detailResponse = document.getElementById('detailResponse');
const detailErrorSection = document.getElementById('detailErrorSection');
const detailError = document.getElementById('detailError');

// 分页相关DOM元素
const itemsPerPageSelect = document.getElementById('itemsPerPage');
const prevPageBtn = document.getElementById('prevPageBtn');
const nextPageBtn = document.getElementById('nextPageBtn');
const pageInfoSpan = document.getElementById('pageInfo');

// 分页状态
let currentPage = 1;
let itemsPerPage = parseInt(itemsPerPageSelect.value); // 初始值从select中获取
let totalPages = 1;
let allFilteredCalls = []; // 存储所有经过筛选但未分页的调用数据

// 新增：获取txm/ysbh输入框
const queryTxmInput = document.getElementById('queryTxm');
const queryYsbhInput = document.getElementById('queryYsbh');

// 渲染调用列表
function renderCallList(calls) {
    callListTableBody.innerHTML = '';
    if (calls.length === 0) {
        callListTableBody.innerHTML = '<tr><td colspan="8" style="text-align: center;">无数据展示</td></tr>';
        return;
    }
    calls.forEach((call, idx) => {
        const row = callListTableBody.insertRow();

        // 添加复选框列
        const checkboxCell = row.insertCell();
        const checkbox = document.createElement('input');
        checkbox.type = 'checkbox';
        checkbox.className = 'row-checkbox';
        checkbox.dataset.bh = call.bh;
        checkbox.onchange = updateSelectedCount;
        checkboxCell.appendChild(checkbox);

        row.insertCell().textContent = idx + 1;
        // 先渲染条形码/原始编号，再渲染信访件编号
        if (queryTxmInput) {
            // 来信：优先取响应体中的 txm（兼容顶层或 data 内），其次取请求体中的 txm
            const txmValue = (
                call.responseInfo?.data?.txm ||
                call.responseInfo?.txm ||
                call.requestInfo?.txm ||
                ''
            );
            row.insertCell().textContent = txmValue;
            row.cells[row.cells.length - 1].title = txmValue; // 添加title属性
        } else if (queryYsbhInput) {
            // 网络：优先取响应体中的 ysbh（兼容顶层或 data 内），其次取请求体中的 ysbh
            const ysbhValue = (
                call.ysbh ||
                call.responseInfo?.data?.ysbh ||
                call.responseInfo?.ysbh ||
                call.requestInfo?.ysbh ||
                ''
            );
            row.insertCell().textContent = ysbhValue;
            row.cells[row.cells.length - 1].title = ysbhValue; // 添加title属性
        } else {
            // 如果没有找到特定的输入框，仍然渲染原始编号列
            // 优先使用API返回的ysbh字段，然后尝试从响应和请求中获取
            const ysbhValue = (
                call.ysbh ||
                call.responseInfo?.data?.ysbh ||
                call.responseInfo?.ysbh ||
                call.requestInfo?.ysbh ||
                ''
            );
            row.insertCell().textContent = ysbhValue;
            row.cells[row.cells.length - 1].title = ysbhValue; // 添加title属性
        }

        // 添加信访件编号列，并设置title属性
        const bhCell = row.insertCell();
        bhCell.textContent = call.bh;
        bhCell.title = call.bh; // 添加title属性
        row.insertCell().textContent = call.startTime;
        // 状态栏：成功绿色，失败红色
        const statusCell = row.insertCell();
        statusCell.textContent = call.status;
        statusCell.classList.add(call.status === '成功' ? 'status-success' : 'status-failed');
        // 处理时间保留两位小数
        const processTimeCell = row.insertCell();
        let pt = call.processTime;
        processTimeCell.textContent = (typeof pt === 'number' && !isNaN(pt)) ? pt.toFixed(2) : '';
        // 操作列
        const actionCell = row.insertCell();
        const detailButton = document.createElement('button');
        detailButton.textContent = '查看详情';
        detailButton.classList.add('action-btn');
        detailButton.onclick = () => showCallDetail(call);
        actionCell.appendChild(detailButton);

        // 添加删除按钮
        const deleteButton = document.createElement('button');
        deleteButton.textContent = '删除';
        deleteButton.classList.add('action-btn', 'delete-btn');
        deleteButton.onclick = () => deleteCallRecord(call.bh);
        actionCell.appendChild(deleteButton);
    });
}

// 更新分页控件状态
function updatePaginationControls() {
    totalPages = Math.ceil(allFilteredCalls.length / itemsPerPage);
    pageInfoSpan.textContent = `${currentPage} / ${totalPages}`;

    prevPageBtn.disabled = currentPage === 1;
    nextPageBtn.disabled = currentPage === totalPages || totalPages === 0;
}

// 显示调用详情模态框
function showCallDetail(call) {
    detailBh.textContent = call.bh;
    detailStartTime.textContent = call.startTime;
    detailStatus.textContent = call.status;
    detailStatus.classList.remove('status-success', 'status-failed');
    detailStatus.classList.add(call.status === '成功' ? 'status-success' : 'status-failed');
    detailProcessTime.textContent = call.processTime.toFixed(2) + ' s';

    detailRequest.textContent = JSON.stringify(call.requestInfo, null, 2);
    detailResponse.textContent = call.responseInfo ? JSON.stringify(call.responseInfo, null, 2) : '无响应信息';

    if (call.errorInfo) {
        detailError.textContent = JSON.stringify(call.errorInfo, null, 2);
        detailErrorSection.style.display = 'block';
    } else {
        detailErrorSection.style.display = 'none';
    }

    detailModal.style.display = 'block';
}

// 隐藏模态框
closeButton.onclick = () => {
    detailModal.style.display = 'none';
};

window.onclick = (event) => {
    if (event.target == detailModal) {
        detailModal.style.display = 'none';
    }
};

// 修改fetchCallData，支持txm/ysbh查询参数
async function fetchCallData(resetPage = false) {
    const queryDate = queryDateInput.value;
    const queryBh = queryBhInput.value;
    const queryStatus = queryStatusSelect.value;

    let url = `${API_PREFIX}/api/calls`;
    const params = new URLSearchParams();

    if (queryDate) params.append('date', queryDate);
    if (queryBh) params.append('bh', queryBh);
    if (queryStatus) params.append('status', queryStatus);
    if (queryTxmInput && queryTxmInput.value) params.append('txm', queryTxmInput.value);
    if (queryYsbhInput && queryYsbhInput.value) params.append('ysbh', queryYsbhInput.value);

    if (params.toString()) url += `?${params.toString()}`;

    try {
        const response = await fetch(url);
        if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
        const result = await response.json();
        if (result.success) {
            allFilteredCalls = result.data;
            if (resetPage) currentPage = 1; // 只有主动查询或重置时才回到第一页
            updatePaginationAndRender();
        } else {
            allFilteredCalls = [];
            updatePaginationAndRender();
        }
    } catch (error) {
        allFilteredCalls = [];
        updatePaginationAndRender();
    }
}

// 根据当前分页状态渲染列表并更新控件
function updatePaginationAndRender() {
    const startIndex = (currentPage - 1) * itemsPerPage;
    const endIndex = startIndex + itemsPerPage;
    const callsToRender = allFilteredCalls.slice(startIndex, endIndex);
    renderCallList(callsToRender);
    updatePaginationControls();
}

// 绑定分页事件
itemsPerPageSelect.addEventListener('change', () => {
    itemsPerPage = parseInt(itemsPerPageSelect.value);
    currentPage = 1; // 改变每页显示数量时，回到第一页
    updatePaginationAndRender();
});

prevPageBtn.addEventListener('click', () => {
    if (currentPage > 1) {
        currentPage--;
        updatePaginationAndRender();
    }
});

nextPageBtn.addEventListener('click', () => {
    if (currentPage < totalPages) {
        currentPage++;
        updatePaginationAndRender();
    }
});

// 搜索按钮
searchButton.addEventListener('click', () => fetchCallData(true));

// 重置按钮
resetButton.addEventListener('click', () => {
    queryDateInput.value = '';
    queryBhInput.value = '';
    queryStatusSelect.value = '';
    if (queryTxmInput) queryTxmInput.value = '';
    if (queryYsbhInput) queryYsbhInput.value = '';
    fetchCallData(true);
});

// 删除调用记录
async function deleteCallRecord(bh) {
    const confirmed = await customConfirm(`确定要删除编号为 ${bh} 的记录吗？`, true);
    if (!confirmed) {
        return;
    }

    try {
        const response = await fetch(`${API_PREFIX}/api/deleteNetCall/${bh}`, {
            method: 'DELETE'
        });

        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }

        const result = await response.json();
        if (result.success) {
            showNotification('删除成功', 'success');
            // 重新获取数据
            fetchCallData(false);
        } else {
            showNotification('删除失败: ' + (result.message || '未知错误'), 'error');
        }
    } catch (error) {
        console.error('删除记录失败:', error);
        showNotification('删除失败: ' + error.message, 'error');
    }
}

// 页面加载时立即渲染一次列表
fetchCallData(false);

// 每 15 秒更新一次调用列表数据
setInterval(() => {
    // 保存当前的选择状态
    const selectedBhs = Array.from(document.querySelectorAll('.row-checkbox:checked')).map(cb => cb.dataset.bh);

    // 获取数据
    fetchCallData(false).then(() => {
        // 数据更新后，恢复选择状态
        setTimeout(() => {
            restoreSelectionState(selectedBhs);
        }, 100);
    });
}, 15000);

// --- 批量删除功能 --- START

// 全选复选框事件
document.getElementById('selectAllCheckbox').addEventListener('change', function () {
    const checkboxes = document.querySelectorAll('.row-checkbox');
    checkboxes.forEach(checkbox => {
        checkbox.checked = this.checked;
    });
    updateSelectedCount();
    updateBatchDeleteButton();
});

// 更新选中数量
function updateSelectedCount() {
    const selectedCheckboxes = document.querySelectorAll('.row-checkbox:checked');
    const selectedCount = selectedCheckboxes.length;
    document.getElementById('selectedCount').textContent = `已选择: ${selectedCount} 项`;
    updateBatchDeleteButton();
}

// 更新批量删除按钮状态
function updateBatchDeleteButton() {
    const selectedCount = document.querySelectorAll('.row-checkbox:checked').length;
    const batchDeleteBtn = document.getElementById('batchDeleteBtn');

    if (selectedCount > 0) {
        batchDeleteBtn.style.display = 'inline-block';
        batchDeleteBtn.disabled = false;
    } else {
        batchDeleteBtn.style.display = 'none';
    }
}

// 更新全选复选框状态
function updateSelectAllCheckbox() {
    const checkboxes = document.querySelectorAll('.row-checkbox');
    const selectAllCheckbox = document.getElementById('selectAllCheckbox');

    if (checkboxes.length === 0) {
        selectAllCheckbox.checked = false;
        selectAllCheckbox.indeterminate = false;
        return;
    }

    const checkedCount = document.querySelectorAll('.row-checkbox:checked').length;

    if (checkedCount === 0) {
        selectAllCheckbox.checked = false;
        selectAllCheckbox.indeterminate = false;
    } else if (checkedCount === checkboxes.length) {
        selectAllCheckbox.checked = true;
        selectAllCheckbox.indeterminate = false;
    } else {
        selectAllCheckbox.checked = false;
        selectAllCheckbox.indeterminate = true;
    }
}

// 恢复选择状态
function restoreSelectionState(selectedBhs) {
    if (!selectedBhs || selectedBhs.length === 0) return;

    const checkboxes = document.querySelectorAll('.row-checkbox');
    checkboxes.forEach(checkbox => {
        if (selectedBhs.includes(checkbox.dataset.bh)) {
            checkbox.checked = true;
        }
    });

    // 更新选择计数和全选状态
    updateSelectedCount();
    updateSelectAllCheckbox();
}

// 批量删除
async function batchDeleteCalls() {
    const selectedCheckboxes = document.querySelectorAll('.row-checkbox:checked');
    if (selectedCheckboxes.length === 0) {
        showNotification('请先选择要删除的记录', 'info');
        return;
    }

    const selectedBhs = Array.from(selectedCheckboxes).map(checkbox => checkbox.dataset.bh);

    const confirmed = await customConfirm(`确定要删除选中的 ${selectedBhs.length} 条记录吗？此操作不可恢复！`, true);
    if (!confirmed) {
        return;
    }

    try {
        const batchDeleteBtn = document.getElementById('batchDeleteBtn');
        batchDeleteBtn.disabled = true;
        batchDeleteBtn.textContent = '删除中...';

        // 批量删除请求
        const response = await fetch(`${API_PREFIX}/api/batchDeleteNetCalls`, {
            method: 'DELETE',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({ bhs: selectedBhs })
        });

        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }

        const result = await response.json();
        if (result.success) {
            showNotification(`成功删除 ${result.deleted_count || selectedBhs.length} 条记录`, 'success');
            // 重新获取数据
            fetchCallData(false);
        } else {
            showNotification('批量删除失败: ' + (result.message || '未知错误'), 'error');
        }
    } catch (error) {
        console.error('批量删除失败:', error);
        showNotification('批量删除失败: ' + error.message, 'error');
    } finally {
        const batchDeleteBtn = document.getElementById('batchDeleteBtn');
        batchDeleteBtn.disabled = false;
        batchDeleteBtn.textContent = '批量删除';
    }
}

// 绑定批量删除按钮事件
document.getElementById('batchDeleteBtn').addEventListener('click', batchDeleteCalls);

// 在renderCallList函数末尾调用更新全选状态
const originalRenderCallList = renderCallList;
renderCallList = function (calls) {
    originalRenderCallList(calls);
    updateSelectAllCheckbox();
};

// --- 批量删除功能 --- END

// --- 自定义确认对话框功能 --- START

// 自定义确认对话框函数
function customConfirm(message, isDanger = false) {
    return new Promise((resolve) => {
        const modal = document.getElementById('customConfirmModal');
        const messageEl = document.getElementById('customConfirmMessage');
        const confirmBtn = document.getElementById('customConfirmConfirm');
        const cancelBtn = document.getElementById('customConfirmCancel');
        const closeBtn = document.querySelector('.custom-confirm-close');

        // 设置消息内容
        messageEl.textContent = message;

        // 设置按钮样式
        if (isDanger) {
            confirmBtn.className = 'custom-confirm-btn danger';
        } else {
            confirmBtn.className = 'custom-confirm-btn confirm';
        }

        // 显示对话框
        modal.style.display = 'block';

        // 确认按钮事件
        const handleConfirm = () => {
            modal.style.display = 'none';
            resolve(true);
            cleanup();
        };

        // 取消按钮事件
        const handleCancel = () => {
            modal.style.display = 'none';
            resolve(false);
            cleanup();
        };

        // 关闭按钮事件
        const handleClose = () => {
            modal.style.display = 'none';
            resolve(false);
            cleanup();
        };

        // 点击背景关闭
        const handleBackgroundClick = (e) => {
            if (e.target === modal) {
                modal.style.display = 'none';
                resolve(false);
                cleanup();
            }
        };

        // 清理事件监听器
        function cleanup() {
            confirmBtn.removeEventListener('click', handleConfirm);
            cancelBtn.removeEventListener('click', handleCancel);
            closeBtn.removeEventListener('click', handleClose);
            modal.removeEventListener('click', handleBackgroundClick);
        }

        // 绑定事件
        confirmBtn.addEventListener('click', handleConfirm);
        cancelBtn.addEventListener('click', handleCancel);
        closeBtn.addEventListener('click', handleClose);
        modal.addEventListener('click', handleBackgroundClick);
    });
}

// 替换原有的confirm调用
async function deleteCallRecord(bh) {
    const confirmed = await customConfirm(`确定要删除编号为 ${bh} 的记录吗？`, true);
    if (!confirmed) {
        return;
    }

    try {
        const response = await fetch(`${API_PREFIX}/api/deleteNetCall/${bh}`, {
            method: 'DELETE'
        });

        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }

        const result = await response.json();
        if (result.success) {
            showNotification('删除成功', 'success');
            // 重新获取数据
            fetchCallData(false);
        } else {
            showNotification('删除失败: ' + (result.message || '未知错误'), 'error');
        }
    } catch (error) {
        console.error('删除记录失败:', error);
        showNotification('删除失败: ' + error.message, 'error');
    }
}

// 替换批量删除的confirm调用
async function batchDeleteCalls() {
    const selectedCheckboxes = document.querySelectorAll('.row-checkbox:checked');
    if (selectedCheckboxes.length === 0) {
        showNotification('请先选择要删除的记录', 'info');
        return;
    }

    const selectedBhs = Array.from(selectedCheckboxes).map(checkbox => checkbox.dataset.bh);

    const confirmed = await customConfirm(`确定要删除选中的 ${selectedBhs.length} 条记录吗？此操作不可恢复！`, true);
    if (!confirmed) {
        return;
    }

    try {
        const batchDeleteBtn = document.getElementById('batchDeleteBtn');
        batchDeleteBtn.disabled = true;
        batchDeleteBtn.textContent = '删除中...';

        // 批量删除请求
        const response = await fetch(`${API_PREFIX}/api/batchDeleteNetCalls`, {
            method: 'DELETE',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({ bhs: selectedBhs })
        });

        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }

        const result = await response.json();
        if (result.success) {
            showNotification(`成功删除 ${result.deleted_count || selectedBhs.length} 条记录`, 'success');
            // 重新获取数据
            fetchCallData(false);
        } else {
            showNotification('批量删除失败: ' + (result.message || '未知错误'), 'error');
        }
    } catch (error) {
        console.error('批量删除失败:', error);
        showNotification('批量删除失败: ' + error.message, 'error');
    } finally {
        const batchDeleteBtn = document.getElementById('batchDeleteBtn');
        batchDeleteBtn.disabled = false;
        batchDeleteBtn.textContent = '批量删除';
    }
}

// --- 自定义确认对话框功能 --- END

// --- 调用列表功能 --- END 

// --- 美观通知提示功能 --- START

// 显示通知提示
function showNotification(message, type = 'success', duration = 3000) {
    // 移除已存在的通知
    const existingNotifications = document.querySelectorAll('.notification');
    existingNotifications.forEach(notification => {
        if (notification.classList.contains('hiding')) return;
        notification.classList.add('hiding');
        setTimeout(() => notification.remove(), 300);
    });

    // 创建新通知
    const notification = document.createElement('div');
    notification.className = `notification ${type}`;

    // 根据类型设置图标
    let icon = '';
    switch (type) {
        case 'success':
            icon = '✓';
            break;
        case 'error':
            icon = '✕';
            break;
        case 'info':
            icon = 'ℹ';
            break;
        default:
            icon = '✓';
    }

    notification.innerHTML = `
    <div class="notification-icon">${icon}</div>
    <div class="notification-text">${message}</div>
    <button class="notification-close" onclick="this.parentElement.remove()">×</button>
  `;

    document.body.appendChild(notification);

    // 自动隐藏
    if (duration > 0) {
        setTimeout(() => {
            if (notification.parentElement) {
                notification.classList.add('hiding');
                setTimeout(() => notification.remove(), 300);
            }
        }, duration);
    }
}

// --- 美观通知提示功能 --- END 